#######################
##### REPLICATION SCRIPT WORD CLOUDS #####
########################################

### We cannot provide the data to reproduce the word clouds due to Twitter's privacy restrictions. We do, however, provide the code used to create the figure.

rm(list = ls())
# Packages
pacman::p_load(rtweet,
               ggplot2,
               dplyr,
               ggwordcloud,
               readxl,
               writexl,
               xlsx,
               corpus,
               broom,
               tidyverse,
               dplyr,
               dotwhisker,
               lubridate,
               stargazer,
               tidytext,
               rpart,
               textclean,
               wordcloud,
               caret,
               ipred,
               tm, 
               stopwords,
               RColorBrewer,
               rpart.plot,
               MASS,
               spacyr,
               randomForest
               
)

wordcloud <- read_excel() #Load data.  
set.seed(1234) # for reproducibility 

  # polish 
  wordcloud(words = wordcloud$polishword, freq = wordcloud$freq,min.freq = 25, 
            scale = c(5, .4),
            max.words=200, random.order=FALSE, rot.per=0,
            colors=brewer.pal(8, "Dark2"))
  
  #english 
  wordcloud(words = wordcloud$englishword, freq = wordcloud$freq, min.freq = 20, 
            scale = c(3, .4),
            max.words=200, random.order=FALSE, rot.per=0,
            colors=brewer.pal(8, "Dark2"))